# 2 1
# 1 2
# 2 1
list_1 = input().split(" ")
n = int(list_1[0])
m = int(list_1[1])
dishes = [list(map(int, input().split())) for i in range(n)]
# print(dishes)
times = sorted([sum(dish) for dish in dishes])
# print(times)
count = 1
for i in range(n):
    total, start, nxt = 1, i, i + 1
    while nxt < n:
        if times[nxt] - times[start] >= m:
            total += 1
            start = nxt
        nxt += 1
        if total > count:
            count = total
print(count)
